package org.restbox;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * Class to provide static application context
 *
 * @author troig
 */
public class ApplicationContextProvider implements ApplicationContextAware {

   /** Application context */
   private static ApplicationContext context = null;

   /**
    * Asign the application context.
    *
    * @param context Application context
    * @throws BeansException
    */
   public void setApplicationContext(ApplicationContext context) throws BeansException {
      ApplicationContextProvider.context = context;
   }

   /**
    * Get the application context
    *
    * @return Applicaction context
    */
   public static ApplicationContext getContext() {
      return context;
   }
}
